# $Id: PKGBUILD 79603 2012-11-08 19:47:00Z lfleischer $
# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Marcin Karpezo <sirmacik at gmail dot com>
# Contributor: Andreas Hauser <andy-aur@splashground.de>

pkgname=dblatex
pkgver=0.3.4
pkgrel=1
pkgdesc='DocBook (XML and SGML) to DVI, PDF, PostScript converter using latex.'
arch=('any')
url='http://dblatex.sourceforge.net/'
license=('GPL')
depends=('docbook-xsl' 'docbook-xml' 'libxslt' 'python2' 'texlive-core' 'texlive-htmlxml'
         'texlive-latexextra' 'texlive-pictures')
source=("http://downloads.sourceforge.net/project/dblatex/dblatex/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.bz2"
        'dblatex-0.3.4-build-fix.patch')
md5sums=('a511a2eaa55757b341e4c46353c5c681'
         '3784801bcfdea61ee45e92bdfc905d4a')

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -Np0 -i ../dblatex-0.3.4-build-fix.patch

  python2 setup.py install --root "${pkgdir}" --catalogs=/etc/xml/docbook-xml
  sed -i -e "s,${pkgdir},," -e "s,#!/usr/bin/env python,#!/usr/bin/env python2," \
    "${pkgdir}/usr/bin/dblatex"
}
